package com.starview.star.operators.arith.runtime;

import com.starview.platform.data.EvaluationException;
import com.starview.platform.data.IFunction;
import com.starview.platform.data.IValue;
import com.starview.platform.data.type.IType;
import com.starview.platform.data.type.StandardTypes;
import com.starview.platform.data.type.TypeUtils;
import com.starview.platform.data.value.Factory;
import com.starview.star.operators.CafeEnter;



public class FloatTrig
{
  /**
   * Trigonometry functions
   */
  public static class FloatSin implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.sin(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatASin implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.asin(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatSinh implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.sinh(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatCos implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.cos(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatACos implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.acos(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatCosh implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.cosh(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatTan implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.tan(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatATan implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.atan(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }

  public static class FloatTanh implements IFunction
  {
    @CafeEnter
    public static double enter(double s1)
    {
      return Math.tanh(s1);
    }

    @Override
    public IValue enter(IValue... args) throws EvaluationException
    {
      return Factory.newFlt(enter(Factory.fltValue(args[0])));
    }

    @Override
    public IType getType()
    {
      IType floatType = StandardTypes.rawFloatType;
      return TypeUtils.functionType(floatType, floatType);
    }
  }
}
